package foundation.union;

public class UnionFind {
    private static int MAXN = 1000001;
    private static int[] father = new int[MAXN];


    private static int n;

    private static void build() {
        for (int i = 0; i < n; i++) {
            father[i] = i;
        }
    }


    private static int find(int x) {
        if (x != father[x]) {
            father[x] = find(father[x]);
        }
        return father[x];
    }

    private static boolean isSameSet(int x, int y) {
        return find(x) == find(y);
    }

    private static void union(int x, int y) {
        father[find(x)] = find(y);
    }


    public static void main(String[] args) {

    }

}
